/**
* @file drv_qspi_flash.h
* @brief  qspi flash
* @details 
* @author huangbin(QQ:405803242)
* @email huangembed@163.com
* @version V1.0.0
* @date 2025-04-20
* @copyright All documents are copyrighted by Shenzhen Xinlongwei Technology Co., LTD.
*            They may not be used for commercial purposes without permission
*/
#ifndef __DRV_QSPI_FLASH_H__
#define	__DRV_QSPI_FLASH_H__
#include "inc.h"
#include <stdint.h>
/* Exported macro ------------------------------------------------------------*/

/* Exported functions ------------------------------------------------------- */

/* High layer functions  */
void sFLASH_DeInit(void);
/**
  * @brief  FLASH initialize.
  */
extern void sFLASH_Init(void);
/**
  * @brief  Erases the specified FLASH sector.4KB
  * @param  SectorAddr: address of the sector to erase.
  * @retval None
  */
extern void sFLASH_EraseSector(uint32_t SectorAddr);
/**
  * @brief  Erases the specified FLASH block.64KB
  * @param  BlockAddr: address of the block to erase.
  */
extern void sFLASH_EraseBlock64K(uint32_t BlockAddr);
/**
  * @brief  Erases the entire FLASH.
  */
extern void sFLASH_EraseChip(void);
/**
  * @brief  Writes block of data to the FLASH. In this function, the number of
  *         WRITE cycles are reduced, using Page WRITE sequence.
  * @param  pBuffer: pointer to the buffer  containing the data to be written
  *         to the FLASH.
  * @param  WriteAddr: FLASH's internal address to write to.
  * @param  NumByteToWrite: number of bytes to write to the FLASH.
  * @retval None
  */
extern void sFLASH_WriteBuffer(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
/**
  * @brief  Reads a block of data from the FLASH.
  * @param  pBuffer: pointer to the buffer that receives the data read from the FLASH.
  * @param  ReadAddr: FLASH's internal address to read from.
  * @param  NumByteToRead: number of bytes to read from the FLASH.
  * @retval None
  */
extern void sFLASH_ReadBuffer(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
/**
  * @brief  Reads FLASH identification.
  * @param  None
  * @retval FLASH identification
  */
extern uint32_t sFLASH_ReadID(void);
/**
  * @brief  config FLASH QE and enter qpi mode.
  * @param  Manufactor: Manufactor id
  * @retval true:success
  */
extern bool sFLASH_Config_QE(uint8_t Manufactor);
/**
  * @brief  Output Driver Strength config,for high speed .
  */
extern void sFLASH_Config_Driver(void);

//test demo
extern void sFLASH_Test(void);


#endif 

